palette: expect palettes/formats to be gamma corrected in 8bit
authorØyvind Kolås <pippin@gimp.org>
Wed, 3 Jan 2018 16:12:41 +0000 (17:12 +0100)
committerØyvind Kolås <pippin@gimp.org>
Wed, 3 Jan 2018 16:12:41 +0000 (17:12 +0100)
A correctness correction related to bug #763581 the formats wanted
by GIMP and expected are gamma corrected not linear, I expect this
fix either does not much for GIMP or fixes an unknown 8bit linear
vs gamma quantization problem that has been lurking in INDEXED mode.

babl/babl-palette.c
tests/palette.c

index fda96ae1f638e21799db861810e6f4f5bd788164..7a06e7d521152364bf42f403ae4b04155ae92d1f 100644 (file)
@@ -136,7 +136,7 @@ static BablPalette *make_pal (const Babl *format, const void *data, int count)
 
   babl_process (babl_fish (format, babl_format ("RGBA double")),
                 data, pal->data_double, count);
-  babl_process (babl_fish (format, babl_format ("RGBA u8")),
+  babl_process (babl_fish (format, babl_format ("R'G'B'A u8")),
                 data, pal->data_u8, count);
 
   babl_palette_reset_hash (pal);
@@ -161,10 +161,10 @@ static BablPalette *default_palette (void)
   memset (&pal, 0, sizeof (pal));
   inited = 1;
   pal.count = 16;
-  pal.format = babl_format ("RGBA u8"); /* dynamically generated, so
-                                           the default palette can
-                                           not be fully static.
-                                         */
+  pal.format = babl_format ("R'G'B'A u8"); /* dynamically generated, so
+                                              the default palette can
+                                              not be fully static.
+                                            */
   pal.data = defpal_data;
   pal.data_double = defpal_double;
   pal.data_u8 = defpal_data;
@@ -576,7 +576,7 @@ const Babl *babl_new_palette (const char  *name,
 
   babl_conversion_new (
      f_pal_u8,
-     babl_format ("RGBA u8"),
+     babl_format ("R'G'B'A u8"),
      "linear", pal_u8_to_rgba_u8,
      "data", palptr,
      NULL);
@@ -584,19 +584,19 @@ const Babl *babl_new_palette (const char  *name,
 
   babl_conversion_new (
      f_pal_a_u8,
-     babl_format ("RGBA u8"),
+     babl_format ("R'G'B'A u8"),
      "linear", pala_u8_to_rgba_u8,
      "data", palptr,
      NULL);
 
   babl_conversion_new (
-     babl_format ("RGBA u8"),
+     babl_format ("R'G'B'A u8"),
      f_pal_a_u8,
      "linear", rgba_u8_to_pal_a,
      "data", palptr,
      NULL);
   babl_conversion_new (
-     babl_format ("RGBA u8"),
+     babl_format ("R'G'B'A u8"),
      f_pal_u8,
      "linear", rgba_u8_to_pal,
      "data", palptr,
index 85192622b866852a84e1a5fddae98acd5477bef4..ce21cf664dfd46e15d63afefb50fac39d6423668 100644 (file)
@@ -40,7 +40,7 @@ main (int    argc,
     assert (palA);
 
     CHECK_CONV("pal to rgba", unsigned char,
-        palA, babl_format("RGBA u8"),
+        palA, babl_format("R'G'B'A u8"),
         in, out);
   }
   if(0){